package fun.stgoder.bmwf.gateway.filter;

import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.stereotype.Component;

import java.util.function.Consumer;

@Component
public class LongInvokeFilter extends AbstractGatewayFilterFactory<Object> {
    @Override
    public GatewayFilter apply(String routeId, Consumer<Object> consumer) {
        return (exchange, chain) -> {
            String url = exchange.getRequest().getURI().getPath();

            return chain.filter(exchange);
        };
    }

    @Override
    public GatewayFilter apply(Object config) {
        return (exchange, chain) -> {
            String url = exchange.getRequest().getURI().getPath();

            return chain.filter(exchange);
        };
    }
}
